package jdbc;

import jdbc.utill.DButil;

import java.sql.Connection;
import java.sql.Statement;

/**
 * 演示工具类封装使用
 */
public class JdbcDemo05 {
    public static void main(String[] args) throws Exception {
        /**
         * create table t_user(
         *     id int primary key  auto_increment,
         *     username varchar(32),
         *     nickename varchar(32),
         *     password  varchar(10),
         *     age int(3)
         * )
         */
        Connection connection = DButil.getConnection();
        Statement statement = connection.createStatement();
        String sql ="create table t_user(\n" +
                "    id int primary key  auto_increment,\n" +
                "    username varchar(32),\n" +
                "    nickname varchar(32),\n" +
                "    password  varchar(10),\n" +
                "    age int(3)\n" +
                ")";
        statement.execute(sql);
        System.out.println("创建表成功");
        DButil.close(connection);

    }
}
